home *** CD-ROM | disk | FTP | other *** search
- case 18: /* edge & gray shade segmentation */
- printf("\nCIPS> Enter input image name\n");
- get_image_name(name);
- printf("\nCIPS> Enter output image name\n");
- get_image_name(name2);
- get_parameters(&il, &ie, &ll, &le);
- get_edge_region_options(er_method,
- &detect_type, &min_area, &max_area,
- &value, &diff, &percent, &erode);
- if(er_method[0] == 'e' ||
- er_method[0] == 'E')
- edge_region(name, name2, the_image,
- out_image, il, ie, ll, le,
- detect_type, min_area,
- max_area, diff, percent,
- value, erode);
- if(er_method[0] == 'g' ||
- er_method[0] == 'G')
- gray_shade_region(name, name2, the_image,
- out_image, il, ie, ll, le,
- diff, min_area, max_area);
- if(er_method[0] == 'c' ||
- er_method[0] == 'C')
- edge_gray_shade_region(name, name2,
- the_image, out_image,
- il, ie, ll, le, detect_type,
- min_area, max_area, diff,
- percent, value, erode);
- break;
-
- .
- .
- .
-
- /*************************************************
- *
- * show_menu(..
- *
- * This function displays the CIPS main menu.
- *
- **************************************************/
- show_menu()
- {
-
- printf("\n\nWelcome to CIPS");
- printf("\nThe C Image Processing System");
- printf("\nThese are you choices:");
- printf("\n\t1. Display image header");
- printf("\n\t2. Show image numbers");
- printf("\n\t3. Print image numbers");
- printf("\n\t4. Display image (VGA & EGA only)");
- printf("\n\t5. Display or print image using "
- "halftoning");
- printf("\n\t6. Print graphics image using "
- "dithering");
- printf("\n\t7. Print or display histogram "
- "numbers");
- printf("\n\t8. Perform edge detection");
- printf("\n\t9. Perform edge enhancement");
- printf("\n\t10. Perform image filtering");
- printf("\n\t11. Perform image addition and "
- "subtraction");
- printf("\n\t12. Perform image cutting and pasting");
- printf("\n\t13. Perform image rotation and "
- "flipping");
- printf("\n\t14. Perform image scaling");
- printf("\n\t15. Create a blank image");
- printf("\n\t16. Perform image thresholding");
- printf("\n\t17. Perform image segmentation");
- printf("\n\t18. Perform edge & gray shade"
- " image segmentation");
- printf("\n\t20. Exit system");
- printf("\n\nEnter choice _\b");
-
- } /* ends show_menu */
-
- .
- .
- .
-
- /********************************************
- *
- * get_edge_region_options(...
- *
- * This function interacts with the user to
- * get the options needed to call the
- * edge and region based segmentation
- * routines.
- *
- ********************************************/
-
- get_edge_region_options(method, edge_type,
- min_area, max_area, set_value,
- diff, percent, erode)
- char method[];
- float *percent;
- int *edge_type;
- short *diff, *erode,
- *min_area, *max_area,
- *set_value;
- {
- int not_finished = 1, response;
-
- while(not_finished){
- printf("\n\nEdge Region Segmentation Options:");
- printf("\n\t1. Method is %s", method);
- printf("\n\t Recall: Edge, Gray shade, "
- "Combination");
- printf("\n\t2. Edge type is %d", *edge_type);
- printf("\n\t Recall: ");
- printf("\n\t 1=Prewitt 2=Kirsch");
- printf("\n\t 3=Sobel 4=quick");
- printf("\n\t 5=homogeneity 6=difference");
- printf("\n\t 7=contrast 8=gaussian");
- printf("\n\t 10=range 11=variance");
- printf("\n\t3. Min area is %d", *min_area);
- printf("\n\t4. Max area is %d", *max_area);
- printf("\n\t5. Set value is %d", *set_value);
- printf("\n\t6. Difference value is %d", *diff);
- printf("\n\t7. Threshold percentage is %f",
- *percent);
- printf("\n\t8. Erode is %d", *erode);
- printf("\n\nEnter choice (0 = no change) _\b");
-
- get_integer(&response);
-
- if(response == 0){
- not_finished = 0;
- }
-
- if(response == 1){
- printf("\n\t Recall: Edge, Gray shade, "
- "Combination");
- printf("\n\t> ");
- read_string(method);
- }
-
- if(response == 2){
- printf("\n\t Recall:");
- printf("\n\t 1=Prewitt 2=Kirsch");
- printf("\n\t 3=Sobel 4=quick");
- printf("\n\t 5=homogeneity 6=difference");
- printf("\n\t 7=contrast 8=gaussian");
- printf("\n\t 10=range 11=variance");
- printf("\n\t__\b");
- get_integer(edge_type);
- }
-
- if(response == 3){
- printf("\nEnter min area:__\b\b");
- get_integer(min_area);
- }
-
- if(response == 4){
- printf("\nEnter max area:__\b\b");
- get_integer(max_area);
- }
-
- if(response == 5){
- printf("\nEnter set value:__\b\b");
- get_integer(set_value);
- }
-
- if(response == 6){
- printf("\nEnter difference:__\b\b");
- get_integer(diff);
- }
-
- if(response == 7){
- printf("\nEnter threshold percentage:__\b\b");
- get_float(percent);
- }
-
- if(response == 8){
- printf("\nEnter erode:__\b\b");
- get_integer(erode);
- }
-
- } /* ends while not_finished */
- } /* ends get_edge_region_options */
-
-